package com.yxjwzpx.management.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.yxjwzpx.management.domain.ShipOwner;
import com.yxjwzpx.management.mapper.ShipOwnerMapper;
import com.yxjwzpx.management.service.IShipOwnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 船家信息管理Service业务层处理
 * 
 * @author yxjwzpx
 * @date 2025-04-08
 */
@Service
public class ShipOwnerServiceImpl implements IShipOwnerService 
{
    @Override
    public int countOwners() {
        return shipOwnerMapper.countAll();
    }


    @Autowired
    private ShipOwnerMapper shipOwnerMapper;

    /**
     * 查询船家信息管理
     * 
     * @param ownerId 船家信息管理主键
     * @return 船家信息管理
     */
    @Override
    public ShipOwner selectShipOwnerByOwnerId(Long ownerId)
    {
        return shipOwnerMapper.selectShipOwnerByOwnerId(ownerId);
    }

    /**
     * 查询船家信息管理列表
     * 
     * @param shipOwner 船家信息管理
     * @return 船家信息管理
     */
    @Override
    public List<ShipOwner> selectShipOwnerList(ShipOwner shipOwner)
    {
        return shipOwnerMapper.selectShipOwnerList(shipOwner);
    }

    /**
     * 新增船家信息管理
     * 
     * @param shipOwner 船家信息管理
     * @return 结果
     */
    @Override
    public int insertShipOwner(ShipOwner shipOwner)
    {
        shipOwner.setCreateTime(DateUtils.getNowDate());
        return shipOwnerMapper.insertShipOwner(shipOwner);
    }

    /**
     * 修改船家信息管理
     * 
     * @param shipOwner 船家信息管理
     * @return 结果
     */
    @Override
    public int updateShipOwner(ShipOwner shipOwner)
    {
        shipOwner.setUpdateTime(DateUtils.getNowDate());
        return shipOwnerMapper.updateShipOwner(shipOwner);
    }

    /**
     * 批量删除船家信息管理
     * 
     * @param ownerIds 需要删除的船家信息管理主键
     * @return 结果
     */
    @Override
    public int deleteShipOwnerByOwnerIds(Long[] ownerIds)
    {
        return shipOwnerMapper.deleteShipOwnerByOwnerIds(ownerIds);
    }

    /**
     * 删除船家信息管理信息
     * 
     * @param ownerId 船家信息管理主键
     * @return 结果
     */
    @Override
    public int deleteShipOwnerByOwnerId(Long ownerId)
    {
        return shipOwnerMapper.deleteShipOwnerByOwnerId(ownerId);
    }

    @Override
    public Long selectOwnerIdByUserId(Long userId) {
        return shipOwnerMapper.selectOwnerIdByUserId(userId);
    }
}
